import unittest

class TestStringMethods(unittest.TestCase):

    def test_upper(self):
        self.assertEqual('foo'.upper(),'FOO')

    def test_split(self):
        s = 'hello world'
        self.assertEqual(s.split(),['hello', 'world'])

        with self.assertRaises(TypeError):  #当分隔符不是字符串时，检查 s.split 是否失败
            s.split(2)

if __name__ == '__main__':
    unittest.main()